$(function(){
	var uName = $.cookie("youleche.u");
	if(uName != null){
		var helpStr = "&nbsp;&nbsp;<span style=\"font-size:12px;color:#ccc;\">|</span>&nbsp;&nbsp;<a href=\"help.jsp\" style=\"color:#666;font-size:14px;\">帮助</a>";
		var myMeile = "<span style=\"color:#666;font-size:14px;\">欢迎你，</span><a  onclick=\"myMeile();\" style=\"cursor:pointer;color:#3CAC7E;font-size:16px;\">" +uName +"</a>";
		$("#divInfo").html(myMeile+helpStr);
	}
});

function myMeile(){
	var u = $.cookie("youleche.u");
	if(u == null){
		window.location.href = "login.jsp";
	}else{
		$.ajax({
			type : 'post',
			dataType : 'text',
			contentType : "application/json",
    		url: "login.do",
    		success: function(v){
    			if(v == "true"){
    				window.location.href = "user/index.jsp";
    			}else{
    				window.location.href = "login.jsp";
    			}
    		}
		});
	}
}
var pageSize = 12;
var pageIndex = 2;
var isEnd = 0;
function getMore(){
	if(isEnd == 0){
		$.ajax({
			type : 'get',
			dataType : 'text',
			url: "sfix.do?action=1&pageSize="+pageSize+"&pageIndex="+pageIndex,
			success: function(v){
				if(v != ""){
					pageIndex ++;
					eval("var jsonFix="+v +";");
					if(jsonFix.length == 0){
						isEnd = 1;
						layer.alert("亲美美，已经没有更多的修理信息了~~~",8);
					}else{
						
					}
				}else{
					layer.alert("亲美美，出现问题了~~~",8);
				}
			}
		});
	}else{
		isEnd = 1;
		layer.alert("亲美美，已经没有更多的修理信息了~~~",8);
	}
}

function getFixInfoStr(imgUrl,shopName,shopAddress, isGoHome){
	var fixInfo = "<div style=\"margin: 7px 7px 20px 7px;float:left;border: 1px solid #ccc;width: 300px;height:280px;\">";
	fixInfo += "<div style=\"height: 90px;border-bottom:1px solid #ccc;width: 298px;\">";
		
	fixInfo += "<img alt=\"商家修理图片\" src=\"userImage/"+imgUrl+"\">";
	fixInfo += "</div>";
		fixInfo += "<div style=\"height: 110px;width: 290px;padding:5px;\">";
		
	fixInfo += "店铺名称："+shopName+"";
	fixInfo += "<br/>";
	fixInfo += "地&nbsp;&nbsp;&nbsp;&nbsp;址："+shopAddress+" [查看地图]  ";
	fixInfo += "<br/>";
	fixInfo += "是否上门："+isGoHome+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[咨询]";
	
    fixInfo += "</div>";
    fixInfo += "<div style=\"height: 60px;width: 300px; vertical-align: middle;text-align:center;padding-top:10px;\">";
	fixInfo += "<input class=\"detail-btn\" type=\"button\" value=\"详细\" onclick=\"details('<%= fixs.get(i).getFixId()%>');\"/>";
	fixInfo += "<input type=\"button\" class=\"detail-btn\"  value=\"收藏\"/>";
	fixInfo += "</div>";
	fixInfo += "</div>";
}

function zixun(imgUrl, shopName){
	$("#imgShop").attr("src", "userImage/" + imgUrl);
	$("#txtDivShopName").html(shopName);
	var i = $.layer({
	    type : 1,
	    title : false,
	    fix : false,
	    offset:['50px' , ''],
	    area : ['400px','400px'],
	    page : {dom : '#contactDiv'}
	});

}

function details(id){
	window.location.href="sfix.do?action=2&id="+id;
}

